﻿@using Coralcode.Adapter.StatVisit.Entity.Domains
@using Coralcode.Utils.Basic
@using CoralNode.MvcClient.Helper
@{
    ViewBag.Title = "访客分析-终端详情";
    ViewBag.PageModule = "visitor";
    ViewBag.CurrentPageUrl = "/m/statistic/visitordevice?orderfield=" + ViewBag.orderfield + "&orderDirection=" + ViewBag.orderDirection + "&deviceinfotype=" + ViewBag.deviceinfotype + "&";
    var order = ViewBag.orderDirection == "up" ? "class=order_up" : "class=order_down";
}
@Html.IncludePage("CoralAdmin/statistic", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        @Html.IncludePage("CoralAdmin/statistic", "DateSelection")
        <div class="main-box mt_2 mb_2">
            <div class="tab-visit clearfix">
                <a href="/m/statistic/visitor?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">地区分布</a>
                <a href="/m/statistic/visitorisp?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">网络运营商</a>
                <a class="current" href="/m/statistic/visitordevice?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">终端详情</a>
                <a href="/m/statistic/visitorisnew?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">新老访客</a>
                <a href="/m/statistic/visitorloyalty?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">忠诚度</a>
                <a href="/m/statistic/visitoractiveness?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">活跃度</a>
            </div>
            <div class="clearfix">
                <div class="table_visit clearfix">
                    <div class="table_visit_l">
                        <ul>
                            <li @if (string.IsNullOrEmpty(ViewBag.deviceinfotype)) {@String.Format("class=current") }><a href="/m/statistic/visitordevice?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselect&orderfield=@ViewBag.orderfield&orderDirection=@ViewBag.orderDirection">终端类型</a></li>
                            <li @if (ViewBag.deviceinfotype == "os"){@String.Format("class=current") }><a href="/m/statistic/visitordevice?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselect&orderfield=@ViewBag.orderfield&orderDirection=@ViewBag.orderDirection&deviceinfotype=os">操作系统</a></li>
                            <li @if (ViewBag.deviceinfotype == "browser"){@String.Format("class=current") }><a href="/m/statistic/visitordevice?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselect&orderfield=@ViewBag.orderfield&orderDirection=@ViewBag.orderDirection&deviceinfotype=browser">浏览器</a></li>
                            <li @if (ViewBag.deviceinfotype == "resolution"){@String.Format("class=current") }><a href="/m/statistic/visitordevice?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselect&orderfield=@ViewBag.orderfield&orderDirection=@ViewBag.orderDirection&deviceinfotype=resolution">分辨率</a></li>
                            <li @if (ViewBag.deviceinfotype == "language"){@String.Format("class=current") }><a href="/m/statistic/visitordevice?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselect&orderfield=@ViewBag.orderfield&orderDirection=@ViewBag.orderDirection&deviceinfotype=language">语言</a></li>
                        </ul>
                    </div>
                    <div class="table_visit_r">
                        <table width="100%" style="margin-top:2px;">
                            <thead>
                                <tr class="t_bg headRow">
                                    <td width="10"></td>
                                    <td>操作系统</td>
                                    <td></td>
                                    <td align="right">浏览次数（PV）|</td>
                                    <td align="right"><div class="l"><a @if (ViewBag.orderField == "pvpercent" || string.IsNullOrEmpty(ViewBag.orderField)) {@String.Format(order)}else{@String.Format("class=order_none")} orderField="pvpercent"><i></i>占比</a></div></td>
                                    <td align="right"><a @if (ViewBag.orderField == "uv"){@String.Format(order)}else{@String.Format("class=order_none")} orderField="uv"><i></i>独立访客(UV)</a></td>
                                    <td align="right"><a @if (ViewBag.orderField == "ip"){@String.Format(order)}else{@String.Format("class=order_none")} orderField="ip"><i></i>IP</a></td>
                                    <td align="right"><a @if (ViewBag.orderField == "newuv"){@String.Format(order)}else{@String.Format("class=order_none")} orderField="newuv"><i></i>新独立访客</a></td>
                                    <td align="right"><a @if (ViewBag.orderField == "sc"){@String.Format(order)}else{@String.Format("class=order_none")} orderField="sc"><i></i>访问次数</a></td>
                                    <td align="right"><a @if (ViewBag.orderField == "depthaverage"){@String.Format(order)}else{@String.Format("class=order_none")} orderField="depthaverage"><i></i>平均访问深度</a></td>
                                    <td></td>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="count">
                                    <td></td>
                                    <td>全站总计</td>
                                    <td></td>
                                    <td align="right">@Model.PageView</td>
                                    <td align="left">@MathUtil.RoundPercent(Model.PageViewPercent)%</td>
                                    <td align="right">@Model.UniqueVisitor</td>
                                    <td align="right">@Model.IpCount</td>
                                    <td align="right">@Model.NewUniqueVisitor</td>
                                    <td align="right">@Model.SessionCount</td>
                                    <td align="right">@MathUtil.Round(Model.PageDepthAverage)</td>
                                    <td></td>
                                </tr>
                                @foreach (StatReportDomain report in ViewBag.SummaryReports) {
                                    <tr class="unfold_wrap @if(report.Equals(ViewBag.LastSummaryReports)){@String.Format("last")}">
                                        <td></td>
                                        <td>@report.StatName</td>
                                        <td align="center"><a class="ml_1-5" href="#"><i class="ico ico_visit_time"></i></a></td>
                                        <td align="right">@report.PageView</td>
                                        <td align="left">@MathUtil.RoundPercent(report.PageViewPercent)%</td>
                                        <td align="right">@report.UniqueVisitor</td>
                                        <td align="right">@report.IpCount</td>
                                        <td align="right">@report.NewUniqueVisitor</td>
                                        <td align="right">@report.SessionCount</td>
                                        <td align="right">@MathUtil.Round(report.PageDepthAverage)</td>
                                        <td align="center"></td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div> 
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $(".headRow a").css("cursor", "pointer").click(function () {
            var orderField = $(this).attr("orderField");
            var orderDirection = ($(this).hasClass("order_none") || $(this).hasClass("order_up"))?"down":"up";
            window.location = "/m/statistic/visitordevice?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselect&deviceinfotype=@ViewBag.deviceinfotype&orderfield=" + orderField + "&orderDirection=" + orderDirection;
        });
    });
</script>